*Backing Out but Backing In Audience Costs? A Replication of Levy et al. (2015)"
*Foreign Policy Analysis
*Makito Takei and Phil Paolino
*MakitoTakei@my.unt.edu
									
*-this filename: TakeiPaolino_FPA.do

*-data filenames: dataset: levy_replication.dta
				 
*-created using Stata 16.0

***For those who are interested, we keep the variables for the original questions before recoding, and below are the descriptions. Regarding how we recode the original variables, please see the "Variable Codings" section in Appendix.

*Experimental Manipulation: If subjjects answer the following questions, then they received that treatment: q27=No Threat, q48=Threat, q32=No Use of Force, q37=Use of Force
*Approval and Approval2: q32 q33 q34 q35 q37 q38 q39 q40  
*Age: q5
*Male: q4
*White: q6
*Democrat: q9
*Ideology: q7
*Income: q8
*Veteran: q21
*Manipulation Checks: q64 q65. The first one askes (1) whether the U.S. president initially said that the United States would stay out of the conflict. The second is on whether the U.S. president eventually sent U.S. military forces to help.

***Log File***
log using TakeiPaolino_FPA_log, text replace

clear
use "levy_replication.dta"

**Experimental Manipulation
*Note: q27=No Threat, q48=Threat, q32=No Use of Force, q37=Use of Force
g Threat=.
replace Threat=0 if q27!=""
replace Threat=1 if q48!=""

g UseForce=.
replace UseForce=0 if q32!=""
replace UseForce=1 if q37!=""

g Condition=.
replace Condition=1 if Threat==0 & UseForce==0
replace Condition=2 if Threat==0 & UseForce==1
replace Condition=3 if Threat==1 & UseForce==0
replace Condition=4 if Threat==1 & UseForce==1
tab Condition

**Note: 1=Stay Out, 2=Back In, 3=Back Out, 4= Go In
label define Condition1 1 "Stay Out" 2 "Back In" 3 "Back Out" 4 "Go In"
label values Condition Condition1
tab Condition

**Manipulation Check
g Manipulation=.
replace Manipulation=1 if Threat==0 & UseForce==0 & q64=="Yes" & q65=="No"
replace Manipulation=1 if Threat==0 & UseForce==1 & q64=="Yes" & q65=="Yes"
replace Manipulation=1 if Threat==1 & UseForce==0 & q64=="No" & q65=="No"
replace Manipulation=1 if Threat==1 & UseForce==1 & q64=="No" & q65=="Yes"
replace Manipulation=0 if Manipulation==.
tab Manipulation

**Marginal Effects (Note: 1=Stay Out, 2=Back In, 3=Back Out, 4= Go In)
g StayOut=.
replace StayOut=0 if Condition==2|Condition==3|Condition==4
replace StayOut=1 if Condition==1

g BackIn=.
replace BackIn=0 if Condition==1|Condition==3|Condition==4
replace BackIn=1 if Condition==2

g BackOut=.
replace BackOut=0 if Condition==1|Condition==2|Condition==4
replace BackOut=1 if Condition==3

g GoIn=.
replace GoIn=0 if Condition==1|Condition==2|Condition==3
replace GoIn=1 if Condition==4

tab Condition StayOut
tab Condition BackIn
tab Condition BackOut
tab Condition GoIn 

**Approval or Not
* Note: 1= Very Strongly Disapprove, 2= Somewhat Disapprove, 3= Lean Toward Approving, 4=Neutral, 5= Lean Toward Disapproving, 6= Somewhat Approve, 7= Very Strongly Approve
tab q32
tab q33
tab q34
tab q35
tab q37
tab q38
tab q39
tab q40

g Approval=.
replace Approval=1 if q32=="Disapprove" & q34=="Very Strongly"
replace Approval=1 if q37=="Disapprove" & q39=="Very Strongly"
replace Approval=2 if q32=="Disapprove" & q34=="Somewhat"
replace Approval=2 if q37=="Disapprove" & q39=="Somewhat"
replace Approval=3 if q32=="Neither Approve Nor Disapprove" & q35=="Lean Toward Disapproving"
replace Approval=3 if q37=="Neither Approve Nor Disapprove" & q40=="Lean Toward Disapproving"
replace Approval=4 if q32=="Neither Approve Nor Disapprove" & q35=="DonEEt Lean Either Way"
replace Approval=4 if q37=="Neither Approve Nor Disapprove" & q40=="DonEEt Lean Either Way"
replace Approval=5 if q32=="Neither Approve Nor Disapprove" & q35=="Lean Toward Approving"
replace Approval=5 if q37=="Neither Approve Nor Disapprove" & q40=="Lean Toward Approving"
replace Approval=6 if q32=="Approve" & q33=="Somewhat"
replace Approval=6 if q37=="Approve" & q38=="Somewhat"
replace Approval=7 if q32=="Approve" & q33=="Very Strongly"
replace Approval=7 if q37=="Approve" & q38=="Very Strongly"

label define Approval 1 "Very Strongly Disapprove" 2 "Somewhat Disapprove" 3 "Lean Toward Disapproving" 4 "Don't Lean Either Way" 5 "Lean Toward Approving" 6 "Somewhat Approve" 7 "Very Strongly Approve"
label values Approval Approval

tab Approval

**Dichotomous Outcome Variables (Not Inclusing Leaners Since Levy et al is unclear)
g Approval2=.
replace Approval2=0 if q32=="Disapprove" & q34=="Very Strongly"
replace Approval2=0 if q37=="Disapprove" & q39=="Very Strongly"
replace Approval2=0 if q32=="Disapprove" & q34=="Somewhat"
replace Approval2=0 if q37=="Disapprove" & q39=="Somewhat"
replace Approval2=0 if q32=="Neither Approve Nor Disapprove" & q35=="Lean Toward Disapproving"
replace Approval2=0 if q37=="Neither Approve Nor Disapprove" & q40=="Lean Toward Disapproving"
replace Approval2=0 if q32=="Neither Approve Nor Disapprove" & q35=="DonEEt Lean Either Way"
replace Approval2=0 if q37=="Neither Approve Nor Disapprove" & q40=="DonEEt Lean Either Way"
replace Approval2=0 if q32=="Neither Approve Nor Disapprove" & q35=="Lean Toward Approving"
replace Approval2=0 if q37=="Neither Approve Nor Disapprove" & q40=="Lean Toward Approving"
replace Approval2=1 if q32=="Approve" & q33=="Somewhat"
replace Approval2=1 if q37=="Approve" & q38=="Somewhat"
replace Approval2=1 if q32=="Approve" & q33=="Very Strongly"
replace Approval2=1 if q37=="Approve" & q38=="Very Strongly"

label define Approval2 0 "Not Approve" 1 "Approve" 
label values Approval2 Approval2
tab Approval2

**Control Variables
*Age
destring q5, generate(num1)
tab num1
g Age=.
replace Age=1 if num1>=18 & num1<=24
replace Age=2 if num1>=25 & num1<=34
replace Age=3 if num1>=35 & num1<=44
replace Age=4 if num1>=45 & num1<=54
replace Age=5 if num1>=55 & num1<=64
replace Age=6 if num1>=65
replace Age=. if num1<18 | num1>150 
tab Age
drop num1

label define Age 1 "18-24" 2 "25-34" 3 "35-44" 4 "45-54" 5 "55-64" 6 "65 or Over"
label values Age Age

*Gender (Male=1)
tab q4
g Male=.
replace Male=1 if q4=="Male"
replace Male=0 if q4=="Female"
tab Male
label define Male 1 "Male" 0 "Female"
label values Male Male

*Race, Ethnicity
tab q6
g White=.
replace White=1 if q6=="White"
replace White=0 if q6=="Asian/Pacific Islander" | q6=="Black or African American" | q6=="Hispanic or Latino" | q6=="Other"
sum White
label define White 1 "White" 0 "Non Whites"
label values White White
tab White

*Ideology
tab q7
g Ideology=.
replace Ideology=1 if q7=="Extremely Conservative"
replace Ideology=2 if q7=="Conservative"
replace Ideology=3 if q7=="Slightly Conservative"
replace Ideology=4 if q7=="Moderate, Middle of the Road" | q7=="Don't Know"
replace Ideology=5 if q7=="Slightly Liberal"
replace Ideology=6 if q7=="Liberal"
replace Ideology=7 if q7=="Extremely Liberal"
tab Ideology
sum Ideology

label define Ideology 1 "Extremely Conservative" 2 "Conservative" 3 "Slightly Conservative" 4 "Moderate, Middle of the Road/Don't Know" 5 "Slightly Liberal" 6 "Liberal" 7 "Extremely Liberal"
label values Ideology Ideology

**Partisanship
tab q9
g Democrat=.
replace Democrat=1 if q9=="Democrat"
replace Democrat=0 if q9!="Democrat"
replace Democrat=. if q9=="Refused"
label define Democrat 1 "Democrat" 0 "Not Democrat"
label values Democrat Democrat
tab Democrat

**Income
tab q8
g Income=.
replace Income=1 if q8=="Less than $25,000"
replace Income=2 if q8=="$25,000 - $49,999"
replace Income=3 if q8=="$50,000 - $74,999"
replace Income=4 if q8=="$75,000 - $99,999"
replace Income=5 if q8=="$100,000 - $124,999"
replace Income=6 if q8=="$125,000 - $149,999"
replace Income=7 if q8=="$150,000 - $174,999"
replace Income=8 if q8=="$175,000 - $199,999"
replace Income=9 if q8=="More than $200,000"
tab Income

label define Income 1 "Less than $25,000" 2 "$25,000 - $49,999" 3 "$50,000 - $74,999" 4 "$75,000 - $99,999" 5 "$100,000 - $124,999" 6 "$125,000 - $149,999" 7 "$150,000 - $174,999" 8 "$175,000 - $199,999" 9 "More than $200,000"
label values Income Income
tab Income

**Veteran
tab q21
gen Veteran=.
replace Veteran=1 if q21=="Yes"
replace Veteran=0 if q21=="No"
tab Veteran

**Table 1
tab Condition if Manipulation==1

**Table 2 (Back Out Audience Costs)
ttest Approval2 if (Condition==1 | Condition==3) & Manipulation==1, by(Condition) 
tab Approval2 Condition if (Condition==1 | Condition==3) & Manipulation==1, chi2 column

**Table 3 (Back In Audience Costs)
ttest Approval2 if (Condition==2 | Condition==4)  & Manipulation==1, by(Condition) 
tab Approval2 Condition if (Condition==2 | Condition==4) & Manipulation==1, chi2 column

**Do they really care about inconsistency? They may more care about use of force (in text)
ttest Approval2 if Manipulation==1, by(UseForce) 
tab Approval2 UseForce if Manipulation==1, chi2 column

**Table 4 (Logit)
logit Approval2 BackOut Age Male White Democrat Ideology Income Veteran if (Condition==1|Condition==3) & Manipulation==1
logit Approval2 BackIn Age Male White Democrat Ideology Income Veteran if (Condition==2|Condition==4) & Manipulation==1

**Evidence for bellegerent divident (in text)
ttest Approval2 if (Condition==1 | Condition==4) & Manipulation==1, by(Condition) 
tab Approval2 Condition if (Condition==1 | Condition==4) & Manipulation==1, chi2 column

**Table A1 (Descriptive Statisitcs)
sum Approval2 StayOut BackIn BackOut GoIn Age White Ideology Democrat Income Veteran if Manipulation==1

**Table A2 (Balance Checks)
ttesttable Age Condition if Manipulation==1, unequal ref(1)
ttesttable Male Condition if Manipulation==1, unequal ref(1)
ttesttable White Condition if Manipulation==1, ref(1) uneq
ttesttable Democrat Condition if Manipulation==1, ref(1) uneq
ttesttable Ideology Condition if Manipulation==1, ref(1) uneq
ttesttable Income Condition if Manipulation==1, ref(1) uneq
ttesttable Veteran Condition if Manipulation==1, ref(1) uneq

**Table A3 (OLS Regressions) 
reg Approval i.Condition if (Condition==1|Condition==3) & Manipulation==1
reg Approval i.Condition Age Male White Democrat Ideology Income Veteran if (Condition==1|Condition==3) & Manipulation==1
reg Approval i2.Condition if (Condition==2|Condition==4) & Manipulation==1
reg Approval i2.Condition Age Male White Democrat Ideology Income Veteran if (Condition==2|Condition==4) & Manipulation==1

**Tables A5 and A6 (Including Those Who Fail to Pass Manipulation Checks)
tab Condition

ttest Approval2 if Condition==1 | Condition==3, by(Condition) 
tab Approval2 Condition if Condition==1 | Condition==3, chi2 column

ttest Approval2 if Condition==2 | Condition==4, by(Condition) 
tab Approval2 Condition if Condition==2 | Condition==4, chi2 column

**Commands to create a new data file for use in the population weighted regression analysis 

gen caseid=10000+_n

keep if Manipulation==1

keep caseid Male White Age Income Approval StayOut BackOut BackIn Democrat Ideology Condition 

save "levy_replication_weighted.dta", replace

log close
